﻿<phone:PhoneApplicationPage 
    x:Class="AugmentedReality.webcam"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="LandscapeLeft"
    mc:Ignorable="d" d:DesignHeight="480" d:DesignWidth="800"
    shell:SystemTray.IsVisible="False" xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps" OrientationChanged="PhoneApplicationPage_OrientationChanged">

    <!--Blinking Locator (property of MyPosition Pushpin) >-->
    <phone:PhoneApplicationPage.Resources>
        <Storyboard x:Name="BlinkLocator" AutoReverse="True" RepeatBehavior="Forever">
            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="locator">
                <EasingColorKeyFrame KeyTime="0" Value="Red"/>
                <EasingColorKeyFrame KeyTime="0:0:1" Value="#FFCEFF00"/>
            </ColorAnimationUsingKeyFrames>
        </Storyboard>
    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Canvas x:Name="Calibrate" Background="Transparent" Visibility="Collapsed">
            <!--Calibration UI-->
            <StackPanel Name="calibrationStackPanel" Background="Black" Opacity="1" Visibility="Collapsed">
                <Image Source="/Images/calibrate_compass.png" Opacity=".95" HorizontalAlignment="Center"/>
                <TextBlock TextWrapping="Wrap" TextAlignment="Center">The compass on your device needs to be calibrated.
                Hold the device in front of you and sweep it through a figure 8 pattern as shown
                until the calibration is complete.</TextBlock>
                <StackPanel Orientation="Horizontal" Margin="0,10" HorizontalAlignment="Center">
                    <TextBlock>heading accuracy:</TextBlock>
                    <TextBlock Name="calibrationTextBlock">0.0°</TextBlock>
                </StackPanel>
                <Button Name="calibrationButton" Content="Done" Click="calibrationButton_Click"></Button>
            </StackPanel>
            <!--End Calibration UI-->
        </Canvas>
        
        <Canvas x:Name="LayoutPortrait" Background="Transparent" Visibility="Collapsed">
            <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <ListBox x:Name="placeList">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Margin="10,50,10,10" Orientation="Horizontal">
                                <Image Source="{Binding Icon}" Height="100" Width="100" HorizontalAlignment="Left" Margin="5,0,5,10" Stretch="UniformToFill" />
                                <TextBlock Text="{Binding Name}" FontSize="32" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Margin="5,20,0,0" Name="placeName" />
                                <TextBlock Text="{Binding Latitude}" FontSize="32" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Margin="5,20,0,0" Name="placeLatitude" />
                                <TextBlock Text="{Binding Longitude}" FontSize="32" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Margin="5,20,0,0" Name="placeLongitude" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </Canvas>

        <Canvas x:Name="LayoutLandscape" Background="Transparent">
        
        <!--Camera viewfinder >-->
        <Rectangle d:LayoutOverrides="GridBox" Margin="0,0,0,0" HorizontalAlignment="Stretch" Name="cameraContent" Height="480" Width="800">
            <Rectangle.Fill>
                <VideoBrush x:Name="viewfinderBrush" />
            </Rectangle.Fill>
        </Rectangle>
        <my:Map CredentialsProvider="AphqDLWGQ6RVfy9G2N6hO-A7xTwncEe0ujbhua37QE2DVtJt3zo-qVrDnFrgEB0K" Mode="aerial" Name="map" Height="480" Width="800">
            <my:Pushpin Name="mapLocator" Visibility="Collapsed">
                <my:Pushpin.Content>
                    <Ellipse Fill="Red" Width="10" Height="10" Name="locator" />
                </my:Pushpin.Content>
            </my:Pushpin>
        </my:Map>
        <TextBlock Height="67" HorizontalAlignment="Left" Margin="12,12,0,0" Name="lblStatus" Text="" VerticalAlignment="Top" Width="500" FontSize="28" />
            <Button Canvas.Left="59" Canvas.Top="274" Content="Button" Height="76" Name="button1" Width="214" Click="button1_Click" />
        </Canvas>
    </Grid>

    

</phone:PhoneApplicationPage>
